package com.cms.bs.config.rs;

import java.util.List;

public class PageRS<T> {
    private int s;
    private Object msg;

    private int pageSize = 100;
    private int pageIndex = 1;
    private int totalPageCount = 0;
    private int totalRowCount = 0;
    private List<T> list = null;

    public PageRS() {
        super();
    }

    public static <T> PageRS<T> ok(int pageIndex, int pageSize, int totalRow, int totalPage, List<T> list) {
        PageRS<T> rs = new PageRS<T>();
        rs.setS(0);
        rs.setPageIndex(pageIndex);
        rs.setPageSize(pageSize);
        rs.setTotalRowCount(totalRow);
        rs.setTotalPageCount(totalPage);
        rs.setList(list);
        return rs;
    }

    public static <T> PageRS<T> bad(Object msg) {
        PageRS<T> rs = new PageRS<T>();
        rs.setS(1);
        rs.setMsg(msg);
        rs.setPageIndex(0);
        rs.setPageSize(0);
        rs.setTotalRowCount(0);
        rs.setTotalPageCount(0);
        rs.setList(null);
        return rs;
    }

    public int getS() {
        return s;
    }

    public void setS(int s) {
        this.s = s;
    }

    public Object getMsg() {
        return msg;
    }

    public void setMsg(Object msg) {
        this.msg = msg;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public int getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(int totalPageCount) {
        this.totalPageCount = totalPageCount;
    }

    public int getTotalRowCount() {
        return totalRowCount;
    }

    public void setTotalRowCount(int totalRowCount) {
        this.totalRowCount = totalRowCount;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

}
